export const acss = (arr, type) => {
	var arrcss = ['.image{width: 100%;height: 5px;display: flex;}','.posire{z-index: 1;position: relative;}','.con{width:92%;margin: auto;}']
	arr.map(item => {
		if (item == 'flex') {
			arrcss.push('.' + item + '{display: flex;}')
		} else if (item == 'flex-a-i') {
			arrcss.push('.' + item + '{display: flex;align-items: center;}')
		} else if (item == 'flex-ju-c') {
			arrcss.push('.' + item + '{display: flex;align-items: center;justify-content: center;}')
		} else if (item == 'flex-ju-b') {
			arrcss.push('.' + item + '{display: flex;align-items: center;justify-content: space-between;}')
		} else if (item == 'flex-ju-a') {
			arrcss.push('.' + item + '{display: flex;align-items: center;justify-content: space-around;}')
		} else if (item == 'center') {
			arrcss.push('.' + item + '{text-align: center;}')
		} else if (item == 'flex-col') {
			arrcss.push('.' + item + '{flex-direction: column;}')
		} else if (item == 'flex-row') {
			arrcss.push('.' + item + '{flex-direction: row-reverse;}')
		} else if (item == 'flex-wrap') {
			arrcss.push('.' + item + '{flex-wrap: wrap;}')
		} else if (item == 'flex1') {
			arrcss.push('.' + item + '{flex:1;}')
		}else if (item == 'one') {
			arrcss.push('.' + item +
				'{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-align: start;-webkit-box-orient: vertical;-webkit-line-clamp:1;}'
			)
		} else if (item == 'two') {
			arrcss.push('.' + item +
				'{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-box-align: start;-webkit-box-orient: vertical;-webkit-line-clamp: 2;}'
			)
		}else if (item == 'posiab') {
			arrcss.push('.' + item + '{position: absolute;}')
		} else if (item == 'posifi') {
			arrcss.push('.' + item + '{position: fixed;}')
		}  else if (item == 'text-left') {
			arrcss.push('.' + item + '{text-align: left;}')
		}else if (item == 'text-right') {
			arrcss.push('.' + item + '{text-align: right;}')
		} else if (item == 'hidden') {
			arrcss.push('.' + item + '{overflow: hidden;}')
		} else if (item == 'status-bar') {
			arrcss.push('.' + item + '{height: var(--status-bar-height);width: 100%;}')
		} else if (/^(mr)/.test(item) || /^(ml)/.test(item) || /^(mt)/.test(item) || /^(mb)/.test(item) ||
			/^(pb)/.test(item) || /^(pt)/.test(item) || /^(pr)/.test(item) || /^(pl)/.test(item)) {
			setcss(item, arrcss)
		} else if (/^(zindex)/.test(item)) {
			let num = item.match(/\d+/)
			arrcss.push('.' + item + '{z-index: ' + num + ';}')
		}else if (/^(bold)/.test(item)) {
			let num = item.match(/\d+/)
			if(num){
				arrcss.push('.' + item + '{font-weight: ' + num + ';}')
			}else{
				arrcss.push('.' + item + '{font-weight: bold;}')
			}
		} else if (/^(size)/.test(item)) {
			let num = item.match(/\d+/)
			let c = item.split(num)[1]
			if (item.indexOf(c) != -1 && item.indexOf(c) != 0) {
				arrcss.push('.' + item + '{font-size: ' + num + c + ';}')
			} else {
				arrcss.push('.' + item + '{font-size: ' + num + 'rpx;}')
			}
		} else if (/^(color)/.test(item)) {
			let ca = item.split('color')[1]
			if (/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(item)) {
				arrcss.push('.' + item + '{color:#' + ca + ';}')
			} else {
				arrcss.push('.' + item + '{color:' + ca + ';}')
			}
		} else if (/^(bg)/.test(item)) {
			let ca = item.split('bg')[1]
			if (/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(item)) {
				arrcss.push('.' + item + '{background:#' + ca + ';}')
			} else {
				arrcss.push('.' + item + '{background:' + ca + ';}')
			}
		} else if (/^(ra)/.test(item)) {
			let num = item.match(/\d+/)
			arrcss.push('.' + item + '{border-radius:' + num + 'rpx;}')
		} else if (/^(opct)/.test(item)) {
			let num = item.match(/\d+/)[0]
			if (num.indexOf('0') != -1) {
				arrcss.push('.' + item + '{opacity: ' + num.replace('0', '0.') + ';}')
			} else {
				arrcss.push('.' + item + '{opacity: ' + num + ';}')
			}
		} else if (/^(pg)/.test(item) || /^(mg)/.test(item)) {
			pmcss(item, arrcss, type)
		} else if (/^(ibg)/.test(item)) {

			if (item.indexOf('to') != -1) {
				let v = item.split('ibgto')[1]
				let f = v.split('-')
				arrcss.push('.' + item + '{background-image: linear-gradient(to right,#' + f[0] + ',#' + f[
					1] + ');}')
			} else {
				let v = item.split('ibg')[1]
				let f = v.split('-')
				arrcss.push('.' + item + '{background-image: linear-gradient(#' + f[0] + ',#' + f[1] +
					');}')
			}
		} else if (/^(width)/.test(item)) {
			wcss(item, "width", type, arrcss);
		} else if (/^(height)/.test(item)) {
			wcss(item, "height", type, arrcss);
		} else if (/^(top)/.test(item)) {
			wcss(item, "top", type, arrcss);
		} else if (/^(bottom)/.test(item)) {
			wcss(item, "bottom", type, arrcss);

		} else if (/^(left)/.test(item)) {
			wcss(item, "left", type, arrcss);
		} else if (/^(right)/.test(item)) {
			wcss(item, "right", type, arrcss);
			
		} else if (/^(box3-)/.test(item)) {
			box3(item,arrcss,type)
		} else if (/^(wh)/.test(item)) {
			let f = item.split('-')
			let num = f[0].match(/\d+/)[0]
			let v = f[0].split(num)

			if (v[1]) {
				arrcss.push('.' + item + '{width:' + num + v[1] + ';' + 'height:' + f[1] + v[1] + ';}')
			} else {
				if (type) {
					arrcss.push('.' + item + '{width:' + num / 32 + 'rem;' + 'height:' + f[1] / 32 + 'rem;}')
				} else {
					arrcss.push('.' + item + '{width:' + num + 'rpx;' + 'height:' + f[1] + 'rpx;}')
				}
			}

		} else if (/^(border)/.test(item)) {
			if (item.indexOf('border-') != -1) {
				if (item.indexOf('border-t') != -1) {
					let ca = item.split('border-t')[1]
					arrcss.push('.' + item + '{border-top:1px solid #' + ca + ';}')
				}
				if (item.indexOf('border-b') != -1) {
					let ca = item.split('border-b')[1]
					arrcss.push('.' + item + '{border-bottom:1px solid #' + ca + ';}')
				}
				if (item.indexOf('border-l') != -1) {
					let ca = item.split('border-l')[1]
					arrcss.push('.' + item + '{border-left:1px solid #' + ca + ';}')
				}
				if (item.indexOf('border-r') != -1) {
					let ca = item.split('border-r')[1]
					arrcss.push('.' + item + '{border-right:1px solid #' + ca + ';}')
				}
			} else {
				let ca = item.split('border')[1]
				if (/([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(item)) {
					arrcss.push('.' + item + '{border:1px solid #' + ca + ';}')
				} else {
					arrcss.push('.' + item + '{border:1px solid ' + ca + ';}')
				}
			}

		}
	})

	return arrcss.join(" ")
	
}


var box3 = (item,arrcss,type)=>{
	let m = item.split('-')[1]
	let mf = item.split('-')[0]
	console.log(m,"kk")
	if(m.indexOf('b') != -1){
		let num = m.match(/\d+/)
		arrcss.push('.' + mf + '{display: flex;justify-content: space-between;flex-wrap: wrap;}')
		arrcss.push('.' + mf + ':after{content:"";height: 0;display: block;width:'+num+'%;}')
		arrcss.push('.a3box{width:'+num+'%;}');
	}else{
		
		if(m.indexOf('rpx') != -1){
			let num = m.match(/\d+/)
			arrcss.push('.' + mf + '{display: flex;justify-content: space-between;flex-wrap: wrap;}')
			arrcss.push('.' + mf + ':after{content:"";height: 0;display: block;width:'+num / 32+'rem;}')
			arrcss.push('.a3box{width:'+num / 32+'rem;}');
		}else{
			arrcss.push('.' + mf + '{display: flex;justify-content: space-between;flex-wrap: wrap;}')
			arrcss.push('.' + mf + ':after{content:"";height: 0;display: block;width:'+m+';}')
			arrcss.push('.a3box{width:'+m+';}');
		}
		
	}
}
var wcss = (item, suscc, type, arrcss) => {
	if (item.indexOf("-") != -1) {
		hu("-", item, type, arrcss, suscc);
	} else {
		hu("", item, type, arrcss, suscc);
	}
};

var hu = (_0x2ebca6, item, type, arrcss, suscc) => {
	let num = item.match(/\d+/);
	let _0x5b5d75 = item.split(num)[1];

	if (item.indexOf(_0x5b5d75) != -1 && item.indexOf(_0x5b5d75) != 0) {
		arrcss.push("." + item + "{" + suscc + ":" + _0x2ebca6 +
			num + _0x5b5d75 + ";}");
	} else {
		if (num == 1000) {
			arrcss.push("." + item + "{" + suscc + ": 100%;}");
		} else {
			if (type) {
				num = num / 32 + "rem";
			} else {
				num = num + "rpx";
			}
			arrcss.push("." + item + "{" + suscc + ": " + _0x2ebca6 + num + ";}");
		}

	}
};

const setcss = (item, arrcss) => {
	var buju = ''
	if (/^(mr)/.test(item)) {
		buju = 'margin-right'
	} else if (/^(ml)/.test(item)) {
		buju = 'margin-left'
	} else if (/^(mt)/.test(item)) {
		buju = 'margin-top'
	} else if (/^(mb)/.test(item)) {
		buju = 'margin-bottom'
	} else if (/^(pr)/.test(item)) {
		buju = 'padding-right'
	} else if (/^(pl)/.test(item)) {
		buju = 'padding-left'
	} else if (/^(pt)/.test(item)) {
		buju = 'padding-top'
	} else if (/^(pb)/.test(item)) {
		buju = 'padding-bottom'
	}


	if (item.indexOf('_i') != -1) {
		var i = item.split('_i')[0]
		var num = item.match(/\d+/)
		var c = i.split(num)[1]
		var str = '.' + item
		var len = item.split('_i')[1] ? item.split('_i')[1] : 1
		for (var a = 0; a < len; a++) {
			str += '.' + item
		}
		if (i.indexOf('-') != -1) {
			if (i.indexOf(c) != -1) {
				if (c == 'baifen') {
					arrcss.push('.' + item + '{' + buju + ':-' + num + '%;}')
				} else {
					arrcss.push('.' + item + '{' + buju + ':-' + num + c + ';}')
				}
			} else {
				arrcss.push(str + '{' + buju + ':-' + num + 'rpx;}')
			}
		} else {
			if (i.indexOf(c) != -1) {
				if (c == 'baifen') {
					arrcss.push(str + '{' + buju + ':' + num + '%;}')
				} else {
					arrcss.push(str + '{' + buju + ':' + num + c + ';}')
				}
			} else {
				arrcss.push(str + '{' + buju + ':' + num + 'rpx;}')
			}
		}

	} else {
		var num = item.match(/\d+/)
		var c = item.split(num)[1]
		if (item.indexOf('-') != -1) {
			if (item.indexOf(c) != -1 && item.indexOf(c) != 0) {
				if (c == 'baifen') {
					arrcss.push('.' + item + '{' + buju + ':-' + num + '%;}')
				} else {
					arrcss.push('.' + item + '{' + buju + ':-' + num + c + ';}')
				}
			} else {
				arrcss.push('.' + item + '{' + buju + ':-' + num + 'rpx;}')
			}
		} else {
			if (item.indexOf(c) != -1 && item.indexOf(c) != 0) {
				if (c == 'baifen') {
					arrcss.push('.' + item + '{' + buju + ':' + num + '%;}')
				} else {
					arrcss.push('.' + item + '{' + buju + ':' + num + c + ';}')
				}
			} else {
				arrcss.push('.' + item + '{' + buju + ':' + num + 'rpx;}')
			}
		}

	}
}

const pmcss = (item, arrcss, type) => {
	var buju = ''
	if (/^(pg)/.test(item)) {
		buju = 'padding'
	} else if (/^(mg)/.test(item)) {
		buju = 'margin'
	}

	if (item.indexOf('-') != -1) {
		let cf = item.split('-')

		let nmh = cf[0].match(/\d+/)
		let n = cf[0].split(nmh)
		if (n[1]) {
			arrcss.push('.' + item + '{' + buju + ':' + nmh + n[1] + ' ' + cf[1] + n[1] + ';}')
		} else {
			if (type) {
				arrcss.push('.' + item + '{' + buju + ':' + nmh / 32 + 'rem ' + cf[1] / 32 + 'rem' + ';}')
			} else {
				arrcss.push('.' + item + '{' + buju + ':' + nmh + 'rpx ' + cf[1] + 'rpx' + ';}')
			}
		}

	} else {
		let num = item.match(/\d+/)
		let c = item.split(num)[1]
		if (item.indexOf(c) != -1 && item.indexOf(c) != 0) {
			arrcss.push('.' + item + '{' + buju + ':' + num + c + ';}')
		} else {
			arrcss.push('.' + item + '{' + buju + ':' + num + 'rpx;}')
		}
	}

}